Security News
JavaScript Leaders Demand Oracle Release the JavaScript Trademark
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
jest-environment-enzyme
Advanced tools
Setting up Enzyme with Jest and React is a somewhat complicated process. There are a lot of dependencies, configuring adapters, etc. This module will take lessen that setup and make it more declarative. This package will also simplify your test files by declaring React, and enzyme wrappers in the global scope. This means that all of your test files don't need to include imports for React or enzyme.
The setup can be as simple as this:
yarn add jest-environment-enzyme jest-enzyme enzyme-adapter-react-* --dev
(Where * is your app's adapter that matches your React version)
For example, if you are using react-16, it should look like:
yarn add jest-environment-enzyme jest-enzyme enzyme-adapter-react-16 --dev
// package.json
"jest": {
"setupFilesAfterEnv": ["jest-enzyme"],
"testEnvironment": "enzyme"
}
Additionally, you can specify which enzyme adapter you want to use through the testEnvironmentOptions.enzymeAdapter
.
Valid options are:
react13
react14
react15
react15.4
react16
(default)// package.json
"jest": {
"setupFilesAfterEnv": ["jest-enzyme"],
"testEnvironment": "enzyme",
"testEnvironmentOptions": {
"enzymeAdapter": "react16"
}
}
Lastly, and most importantly, this library has a hard requirement on jest-enzyme
.
FAQs
Runtime Environment for enzyme tests in jest
The npm package jest-environment-enzyme receives a total of 338,649 weekly downloads. As such, jest-environment-enzyme popularity was classified as popular.
We found that jest-environment-enzyme demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
In an open letter, JavaScript community leaders urge Oracle to give up the JavaScript trademark, arguing that it has been effectively abandoned through nonuse.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.